package com.medical.admin.patient.controller;

import com.medical.admin.patient.common.dto.BeHospitalizedDto;
import com.medical.admin.cost.common.dto.DetailInfo;
import com.medical.admin.patient.service.BeHospitalizedService;
import com.qf.medical.response.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * 1.查询住院信息
 * 2.增加住院信息
 * 3.修改住院信息
 * 4.删除住院信息
 * 5.查询住院订单详情
 */
@Api(tags = "住院信息api在线文档")
@RestController
@RequestMapping("/hospitalized")
public class BeHospitalizedController {
    @Resource
    private BeHospitalizedService beHospitalizedService;

    @ApiOperation("查询住院信息")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    @GetMapping("/search")
    public ResponseEntity<BeHospitalizedDto> searchHospitalized(@NotNull Long patientId) {
        return ResponseEntity.success(beHospitalizedService.searchHospitalized(patientId));
    }

    @ApiOperation("增加住院信息")
    @ApiImplicitParam(name = "beHospitalizedDto",value = "住院信息Dto类")
    @PostMapping("/add")
    public ResponseEntity<Integer> addHospitalized(@NotNull @RequestBody BeHospitalizedDto beHospitalizedDto) {
        return ResponseEntity.success(beHospitalizedService.addHospitalized(beHospitalizedDto));
    }

    @ApiOperation("修改住院信息")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    @PutMapping("/modify")
    public ResponseEntity<Integer> modifyHospitalized(@NotNull @RequestBody BeHospitalizedDto beHospitalizedDto) {
        return ResponseEntity.success(beHospitalizedService.modifyHospitalized(beHospitalizedDto));
    }

    @ApiOperation("删除住院信息")
    @ApiImplicitParam(name = "patientId",value = "患者id")
    @DeleteMapping("/remove")
    public ResponseEntity<Integer> removeHospitalized(@NotNull Long patientId) {
        return ResponseEntity.success(beHospitalizedService.removeHospitalized(patientId));
    }

    @ApiOperation("查询住院订单详情")
    @ApiImplicitParam(name = "indentId",value = "订单id")
    @GetMapping("/hospitalizedDetail")
    public ResponseEntity<DetailInfo> searchHospitalizedDetail(@NotNull Long indentId) {
        return ResponseEntity.success(beHospitalizedService.searchHospitalizedDetail(indentId));
    }
}
